﻿<head>
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>

    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
    <div id="mapp">
        <template>

            <div class="line"></div>
            <el-menu default-active="activeIndex2"
                     class="el-menu-demo"
                     mode="horizontal"
                     background-color="#545c64"
                     text-color="#fff"
                     active-text-color="#ffd04b">
                <el-menu-item index="1" v-on:click="gotoIndex">花名册</el-menu-item>
                <el-menu-item index="2" v-on:click="gotoAddPerson" v-if="adminUser">添加工程师</el-menu-item>
                <el-submenu index="3">
                    <template slot="title">
                        薪水计算
                    </template>
                    <el-menu-item index="3-1" v-on:click="gotoMoney">薪水计算</el-menu-item>
                </el-submenu>

                <el-submenu index="4">
                    <template slot="title">
                        生成报表
                    </template>
                    <el-menu-item index="4-2" v-on:click="gotoMoneyView">薪水报表</el-menu-item>
                </el-submenu>
                <el-menu-item index="5" v-on:click="gotoAddAdmin" v-if="adminUser">添加账户</el-menu-item>
            </el-menu>

        </template>
    </div>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script src="https://unpkg.com/vue-router@2.0.0/dist/vue-router.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>

    <script>

        var modelapp = new Vue({
            el:'#mapp',
            data:{
                activeIndex: '1',
                activeIndex2: '1',
                adminUser:false,
            },
            created() {
                var a = localStorage.getItem('region');
                if (a == "管理员")
                    this.adminUser = true;
            },
            methods: {
                gotoIndex() {
                    window.location.href = "/Test/Index";
                },
                gotoAddPerson() {
                    window.location.href = "/Test/addPersonView";
                },
                gotoAddAdmin(){
                    window.location.href = "/Test/adminView";
                },
                gotoMoney() {
                    window.location.href = "/Test/MoneyView";
                },
                gotoMoneyView() {
                    window.location.href = "/Test/MoneyInfoView";
                },
                handleSelect(key, keyPath) {
                    console.log(key, keyPath);
                }
            }
        })
    </script>
    <div>
        @RenderBody()
    </div>
</body>
